*/
$wgPriorityHints = false;
+/**
+ * Enable Element Timing.
+ *
+ * @warning EXPERIMENTAL!
+ *
+ * @since 1.34
+ * @var bool
+ */
+$wgElementTiming = false;
+
/**
* For really cool vim folding this needs to be at the end:
* vim: foldmarker=@{,@} foldmethod=marker
* @return string
*/
function toHtml( $options = [] ) {
- global $wgPriorityHints;
+ global $wgPriorityHints, $wgElementTiming;
if ( count( func_get_args() ) == 2 ) {
throw new MWException( __METHOD__ . ' called in the old style' );
'decoding' => 'async',
];
+ $elementTimingName = 'thumbnail';
+
if ( $wgPriorityHints
&& !self::$firstNonIconImageRendered
&& $this->width * $this->height > 100 * 100 ) {
self::$firstNonIconImageRendered = true;
$attribs['importance'] = 'high';
+ $elementTimingName = 'thumbnail-high';
+ }
+
+ if ( $wgElementTiming ) {
+ $attribs['elementtiming'] = $elementTimingName;
}
if ( !empty( $options['custom-url-link'] ) ) {